package jwdt.xadmin.system.bean;

import java.util.ArrayList;
import java.util.List;

import jwdt.common.util.CacheUtil;

import com.ezerg.db.Jdb;
import com.ezerg.db.annotation.Column;
import com.ezerg.db.annotation.Table;

@SuppressWarnings("rawtypes")
@Table(name="t_user", keys={"userid"}, comment="")
public class TUser implements java.io.Serializable {

	private static final long serialVersionUID = 1L;

	@Column(value="userid", comment="")
	private Integer userid;
	
	@Column(value="username", comment="用户名")
	private String username;
	
	@Column(value="userpassword", comment="用户类型")
	private String userpassword;
	
	@Column(value="usertype", comment="")
	private Integer usertype;
	
	@Column(value="oskey", comment="")
	private String oskey;
	
	@Column(value="fullname", comment="")
	private String fullname;
	
	@Column(value="userquestion", comment="")
	private String userquestion;
	
	@Column(value="useranswer", comment="")
	private String useranswer;
	
	@Column(value="usersex", comment="")
	private String usersex;
	
	@Column(value="userbirthday", comment="")
	private String userbirthday;
	
	@Column(value="useremail", comment="")
	private String useremail;
	
	@Column(value="content", comment="")
	private String content;
	
	@Column(value="userlastip", comment="")
	private String userlastip;
	
	@Column(value="number", comment="")
	private Integer number;
	
	@Column(value="userlogins", comment="")
	private Integer userlogins;
	
	@Column(value="lastlogin", comment="")
	private String lastlogin;
	
	@Column(value="joindate", comment="")
	private String joindate;
	
	@Column(value="depid", comment="")
	private Integer depid;
	
	@Column(value="adder", comment="")
	private String adder;
	
	@Column(value="tel", comment="")
	private String tel;
	
	@Column(value="shenhe", comment="")
	private Integer shenhe;
	
	@Column(value="jinyong", comment="")
	private Integer jinyong;
	
	@Column(value="reglevel", comment="")
	private Integer reglevel;
	
	@Column(value="userface", comment="")
	private String userface;
	
	List authorities = new ArrayList();
	
	public boolean hasAuthority(String auth) {
		return authorities.contains(auth);
	}

	@SuppressWarnings("unchecked")
	public void setAuthority(List auths) {
		authorities.addAll(auths);
	}
	
	public Integer getUserid() {
		return userid;
	}
	
	public void setUserid(Integer userid) {
		this.userid = userid;
	}

	public String getUsername() {
		return username;
	}
	
	public void setUsername(String username) {
		this.username = username;
	}
	public String getUserpassword() {
		return userpassword;
	}
	
	public void setUserpassword(String userpassword) {
		this.userpassword = userpassword;
	}
	public Integer getUsertype() {
		return usertype;
	}
	
	public void setUsertype(Integer usertype) {
		this.usertype = usertype;
	}
	
	public String getOskeyname() {
		return Jdb.get().queryForString("select jsmc from jwdt_qx_js where jsdm=?", new Object[]{oskey}, CacheUtil.C0);
	}
	public String getOskey() {
		return oskey;
	}
	
	public void setOskey(String oskey) {
		this.oskey = oskey;
	}
	public String getFullname() {
		return fullname;
	}
	
	public void setFullname(String fullname) {
		this.fullname = fullname;
	}
	public String getUserquestion() {
		return userquestion;
	}
	
	public void setUserquestion(String userquestion) {
		this.userquestion = userquestion;
	}
	public String getUseranswer() {
		return useranswer;
	}
	
	public void setUseranswer(String useranswer) {
		this.useranswer = useranswer;
	}
	public String getUsersex() {
		return usersex;
	}
	
	public void setUsersex(String usersex) {
		this.usersex = usersex;
	}

	public String getUserbirthday() {
		return userbirthday;
	}
	
	public void setUserbirthday(String userbirthday) {
		this.userbirthday = userbirthday;
	}
	public String getUseremail() {
		return useremail;
	}
	
	public void setUseremail(String useremail) {
		this.useremail = useremail;
	}
	public String getContent() {
		return content;
	}
	
	public void setContent(String content) {
		this.content = content;
	}
	public String getUserlastip() {
		return userlastip;
	}
	
	public void setUserlastip(String userlastip) {
		this.userlastip = userlastip;
	}
	public Integer getNumber() {
		return number;
	}
	
	public void setNumber(Integer number) {
		this.number = number;
	}
	public Integer getUserlogins() {
		return userlogins;
	}
	
	public void setUserlogins(Integer userlogins) {
		this.userlogins = userlogins;
	}
	public String getLastlogin() {
		return lastlogin;
	}
	
	public void setLastlogin(String lastlogin) {
		this.lastlogin = lastlogin;
	}
	public String getJoindate() {
		return joindate;
	}
	
	public void setJoindate(String joindate) {
		this.joindate = joindate;
	}
	public Integer getDepid() {
		return depid;
	}
	public String getDepname() {
		if(this.depid!=null && this.depid>0) {
			TDep d = (TDep)Jdb.get().get(TDep.class, depid);
			return d.getName();
		}
		return "";
	}
	public void setDepid(Integer depid) {
		this.depid = depid;
	}
	
	public String getAdder() {
		return adder;
	}
	
	public void setAdder(String adder) {
		this.adder = adder;
	}
	public String getTel() {
		return tel;
	}
	
	public void setTel(String tel) {
		this.tel = tel;
	}
	public Integer getShenhe() {
		return shenhe;
	}
	
	public void setShenhe(Integer shenhe) {
		this.shenhe = shenhe;
	}
	public Integer getJinyong() {
		return jinyong;
	}
	
	public void setJinyong(Integer jingyong) {
		this.jinyong = jingyong;
	}
	public Integer getReglevel() {
		return reglevel;
	}
	
	public void setReglevel(Integer reglevel) {
		this.reglevel = reglevel;
	}
	public String getUserface() {
		return userface;
	}
	
	public void setUserface(String userface) {
		this.userface = userface;
	}
}
